<!--{include file="header.html"}-->
<!-- END HEAD -->
<!-- BEGIN BODY -->
<style type="text/css">
    .portlet-body img{
        width:auto;
        height:auto;
    }
</style>
<body class="page-header-fixed">
<!-- BEGIN HEADER -->
<!--{include file="top.html"}-->
<!-- END HEADER -->
<!-- BEGIN CONTAINER -->
<div class="page-container row-fluid">
    <!-- BEGIN SIDEBAR -->
    <div class="page-sidebar nav-collapse collapse">
        <!-- BEGIN SIDEBAR MENU -->
        <!--{include file="menu.html"}-->
        <!-- END SIDEBAR MENU -->
    </div>
    <!-- END SIDEBAR -->
    <!-- BEGIN PAGE -->
    <div class="page-content">
        <!-- BEGIN PAGE CONTAINER-->
        <div class="container-fluid">
            <!-- BEGIN PAGE HEADER-->
            <div class="row-fluid">
                <div class="span12">
                    <!-- BEGIN PAGE TITLE & BREADCRUMB-->
                    <!--{include file="nav.html"}-->
                    <!-- END PAGE TITLE & BREADCRUMB-->
                </div>
            </div>
            <!-- END PAGE HEADER-->
            <!-- BEGIN PAGE CONTENT-->
            <div class="row-fluid">
                <div class="span12">
                    <!-- BEGIN VALIDATION STATES-->
                    <div class="portlet box purple">
                        <div class="portlet-title">
                            <div class="caption"><i class="icon-reorder"></i>参加活动</div>
                        </div>
                        <div class="portlet-body form">
                            <!--歌曲添加开始-->
                            <div class="goods_add">
								<form class="form-horizontal">
                                    <input type="hidden" name="id_commodity" value="<!--{$id_community}-->"/>
                                    <input type="hidden" name="url_action" value="<!--{$url}-->"/>
                                    <div class="control-group">
										<label class="control-label">用户名：<span class="required">*</span></label>
										<div class="controls">
											<input name="name" type="text" value="" class="span6 m-wrap" placeholder="请输入要搜索的内容"/>
										    <a class="btn purple" onclick="search_customer()">查 询</a>
                                            <div id="show_customer" style="margin-top: 20px"></div>
                                        </div>
                                    </div>
                                    <div class="control-group">
                                        <label class="control-label">手机号：</label>
                                        <div class="controls">
                                            <input name="phone" type="text" value="" class="span6 m-wrap" placeholder="请输入参加活动用户手机号码。"/>
                                        </div>
                                    </div>
									<div class="form-actions">
										<button type="button" class="btn purple" onclick="submit_activity()">确定</button>
                                        <button type="button" class="btn" onClick="javascript:window.location.href='<!--{$url}-->'">取消</button>
									</div>
								</form>
                            </div>
                        </div>
                    </div>
                    <!-- END VALIDATION STATES-->
                </div>
            </div>
            <!-- END PAGE CONTENT-->
        </div>
        <!-- END PAGE CONTAINER-->
    </div>
    <!-- END PAGE -->
</div>
<!-- END CONTAINER -->
<!-- BEGIN FOOTER -->
<!--{include file="footer.html"}-->
<!-- END PAGE LEVEL STYLES -->
<script>
    jQuery(document).ready(function() {
       // initiate layout and plugins
       App.init();
    });

    /*
    zxx
    查询会员用户
     */
    function search_customer(){
        var name = $('[name="name"]').val();
        var names = name.replace(/(\r)*\n/g,"").replace(/\s/g,"");
        if(names == ''){
            alert('请输入搜索内容！');
            return;
        }
        $.post('<!--{$url_prefix}-->community/search_customer', {
            'name' : name
        },function(data){
        var html = '';
            if(data.status == 1){
                $.each(data.msg, function(key, value) {
                    html += '<em class="checked"><input type="radio" name="select_name"';
                    if(key == 0){
                        html += ' checked="checked"';
                    }
                    html += ' value="' +value.id_user+ '"/>' +value.name+ '</em>&nbsp;&nbsp;&nbsp;';
                });
                $('#show_customer').html(html);
            }else{
                alert(data.msg);
                window.location.reload();
            }
        },'json');
    }

    /*
    zxx
    参加活动
     */
    function submit_activity(){
        $.post('<!--{$url_prefix}-->community/join_community', {
            'id_user' : $('input[name="select_name"]:checked').val(),
            'phone':$('[name="phone"]').val(),
            'id_commodity':$('[name="id_commodity"]').val(),
            'url_action':$('[name="url_action"]').val()
        },function(data){
            alert(data.msg);
            window.location.href=data.url;
        },'json');
    }
</script>
<!-- END JAVASCRIPTS -->
</body>
<!-- END BODY -->
</html>